﻿using Hospital.IRepository;
using Hospital.Model.DTO;
using Hospital.Model.entity;
using SqlSugar;
using System.Linq.Expressions;

namespace Hospital.Repository
{
    public class DoctorRepository : BaseRepository<Doctor>, IDoctorRepository
    {
        public DoctorRepository(ISqlSugarClient db) : base(db)
        {
        }

        public async override Task<List<Doctor>> QueryAsync()
        {
            return await base.Context.Queryable<Doctor>()
                .Mapper(c => c.JobTitle, c => c.JobTitleId, c => c.JobTitle.Id)
                .Mapper(c => c.Specialty, c => c.SpecialtyId, c => c.Specialty.Id)
                .Mapper(c => c.Department, c => c.DepartmentId, c => c.Department.Id)
                .ToListAsync();
        }
    }
}
